<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数组的迭代方法</title>
    
</head>
<body>
    <script type="text/javascript">
        // 1.过滤方法 filter()
        var numbers = [1, 2, 3, 6, 19, 4, 20];
        var filterResult = numbers.filter(function(item,index,array){
            return item > 3;
        });
        console.log(filterResult);

        // 2.map()方法
        var mapResult = numbers.map(function(item,index,array){
            return item*2;
        });
        console.log(mapResult);

        // 3.遍历 forEach()
        numbers.forEach(function(item,index){
            console.log(item,index);
        });
    </script>
</body>
</html>